package com.Calculator.view.TextField.impl;

import com.Calculator.models.impl.Theme;
import com.Calculator.view.TextField.iMyJTextField;

import javax.swing.*;
import java.awt.*;

public class ProcessText implements iMyJTextField{
    // 计算器过程显示文本框
    private JTextField processText;
    //计算过程
    private String process;

    public ProcessText(Theme theme) {
        //设置预显示文本
        process = "我是计算过程";
        processText = new JTextField(process);
        //设置大小
        processText.setPreferredSize(new Dimension(theme.getWidth(), theme.getHeight()*8/60));
        //设置文本靠右显示
        processText.setHorizontalAlignment(JTextField.RIGHT);
        //设置文本不可更改
        processText.setEditable(false);
        //设置字体
        processText.setFont(new Font(null, Font.BOLD, 20));
        processText.setForeground(new Color(128, 128, 128));
        //设置背景颜色
//        processText.setBackground(Color.magenta);

        //添加监听器
//        processText.addKeyListener();
    }

    public String getProcess() {
        return process;
    }

    public void setProcess(String s) {
        this.process = s;
    }

    @Override
    public JTextField getJTextField() {
        return processText;
    }

    @Override
    public void setJTextField(JTextField jTextField) {
        this.processText = jTextField;
    }


}
